<template>
  <div class="account">
    <header>
      <van-nav-bar
        title="账户余额"
        left-text=""
        right-text="提现"
        left-arrow
        @click-left="onClickLeft"
        @click-right="onClickRight"
      />
    </header>
    <div class="balance">
      <div class="number">
        <span>账户余额(元)</span>
        <p>{{ state.number }}</p>
      </div>
      <div class="button">
        <button @click="but">充值</button>
      </div>
      <van-dialog v-model:show="show" title="请输充值金额" show-cancel-button>
        <van-cell-group inset>
          <!-- 输入密码 -->
          <van-field v-model="state.number" type="number" label="金额" />
        </van-cell-group>
      </van-dialog>
    </div>
    <div class="particulars">收支明细</div>
  </div>
</template>

<script>
import { Toast } from "vant";
import { Dialog } from "vant";
import { reactive } from "vue";
import { useRouter } from "vue-router";
import { ref } from "vue";
export default {
  components: {
    [Dialog.Component.name]: Dialog.Component,
  },
  setup() {
    const route = useRouter();
    const onClickLeft = () => route.push("/home/mine");
    const onClickRight = () => Toast("按钮");
    const state = reactive({ number: "" });
    const show = ref(false);
    const but = () => {
      show.value = true;
    };
    return {
      onClickLeft,
      onClickRight,
      route,
      state,
      show,
      but,
    };
  },
};
</script>

<style lang="less">
.account {
  width: 100%;
  .balance {
    display: flex;
    justify-content: space-between;
    height: 80px;
    .number {
      width: 50%;
      position: relative;
      span {
        display: inline-block;
        width: 100%;
        font-size: 13px;
        position: absolute;
        top: 21px;
        left: 30px;
        color: rgb(102, 101, 101);
      }
      p {
        position: absolute;
        top: 27px;
        left: 39px;
        line-height: 0;
      }
    }
    .button {
      position: relative;
      width: 50%;
      button {
        background: rgb(7, 173, 250);
        position: absolute;
        top: 28px;
        right: 30px;
        font-size: 14px;
        color: #fff;
        width: 66px;
        height: 30px;
        border-radius: 15px;
        border: none;
      }
    }
  }
  .particulars {
    background: rgb(238, 237, 234);
    width: 100%;
    height: 30px;
    font-size: 10px;
    color: rgb(102, 101, 101);
    text-indent: 30px;
    line-height: 30px;
  }
}
</style>
